#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    string s;

    getline(cin, s);

    reverse(s.begin(), s.end());

    int left = 0;
    int right = 0;
    while (right < s.size())
    {
        left = right;
        while (right < s.size() && s[right] != ' ')
            right++;
        reverse(s.begin() + left, s.begin() + right);
        while (right < s.size() && s[right] == ' ')
            right++;

    }

    cout << s << endl;
    return 0;
}